package cn.stronglink.assetmanage.business.check.view.wait;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.stronglink.assetmanage.MainActivity;
import cn.stronglink.assetmanage.R;
import cn.stronglink.assetmanage.business.check.adapter.CheckListAdapter;
import cn.stronglink.assetmanage.business.check.view.detail.AddCheckDetailFragment;
import cn.stronglink.assetmanage.entity.Check;
import cn.stronglink.assetmanage.index.entity.PromissionEntity;
import cn.stronglink.assetmanage.utils.Constants;

/**
 * 操作待入库界面
 * Created by chencongcong on 2018/6/12.
 */

public class WaitListView {
    private Fragment fragment;
    //表单列表
    @BindView(R.id.rv_checkwait_order_list)
    RecyclerView rv_checkwait_order_list;
    //表单列表adapter
    private CheckListAdapter listAdapter;

    public WaitListView(Fragment fragment, View view, CheckListAdapter listAdapter) {
        this.fragment = fragment;
        ButterKnife.bind(this, view);
        this.listAdapter = listAdapter;

    }


    /**
     * 设置表单列表数据
     *
     * @param listData 表单列表
     */
    public void setListData(List<Check> listData) {
        if (listAdapter != null) {
            listAdapter.notifyDatasChanged(listData);
        }
    }


    public void showWaitAssetData(String orderNo) {
        //跳转到详情页面
        Fragment assetFragment = new WaitAssetFragment();
        FragmentManager fragmentManager = fragment.getActivity().getSupportFragmentManager();
        FragmentTransaction transaction = fragmentManager.beginTransaction();
        transaction.replace(R.id.frame_business, assetFragment);
        transaction.commit();
        Bundle bundle = new Bundle();
        bundle.putString(Constants.CHECK_IN_DETAIL_NO, orderNo);
        assetFragment.setArguments(bundle);
    }

}
